//
//  JKLTabBar.m
//  BaiSi
//
//  Created by 李善武 on 16/5/10.
//  Copyright © 2016年 李善武. All rights reserved.
//

#import "JKLTabBar.h"
#import "UIView+Frame.h"
@interface JKLTabBar()

@end
@implementation JKLTabBar

- (void)layoutSubviews{
   
    [super layoutSubviews];
    NSInteger count = self.items.count;
    CGFloat btnX = 0;
    CGFloat btnY = 0;
    CGFloat btnW = self.lsw_width/count;
    CGFloat btnH = self.lsw_height;
    
    // 遍历子控件
    int i = 0;
    for (UIControl *tabBarButton  in self.subviews) {
        
        if ([tabBarButton isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
            btnX = btnW * i;
            tabBarButton.frame = CGRectMake(btnX, btnY, btnW, btnH);
            i += 1;
        }
        
    }
    
}
@end
